package com.fr.cell;

import com.fr.base.core.GraphHelper;
import com.fr.cell.core.GridCornerMouseHandler;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D.Double;
import javax.swing.ActionMap;
import javax.swing.InputMap;

public class GridCorner extends BaseGridComponent
{
  public GridCorner()
  {
    setOpaque(true);
    GridCornerMouseHandler localGridCornerMouseHandler = new GridCornerMouseHandler(this);
    addMouseListener(localGridCornerMouseHandler);
    addMouseMotionListener(localGridCornerMouseHandler);
    getInputMap().clear();
    getActionMap().clear();
  }

  public void paintComponent(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    ReportPane localReportPane = getReportPane();
    Dimension localDimension = getSize();
    Rectangle2D.Double localDouble = new Rectangle2D.Double(0.0D, 0.0D, localDimension.getWidth(), localDimension.getHeight());
    if (getBackground() != null)
    {
      localGraphics2D.setPaint(getBackground());
      GraphHelper.fill(localGraphics2D, localDouble);
    }
    else
    {
      localGraphics2D.setPaint(localReportPane.getBackground());
      GraphHelper.fill(localGraphics2D, localDouble);
    }
    localGraphics2D.setColor(localReportPane.getGridColumn().getSeparatorLineColor());
    GraphHelper.drawLine(localGraphics2D, 0.0D, 0.0D, 0.0D, localDimension.getHeight());
    localGraphics2D.setColor(localReportPane.getGridRow().getSeparatorLineColor());
    GraphHelper.drawLine(localGraphics2D, 0.0D, 0.0D, localDimension.getWidth(), 0.0D);
  }

  public Dimension getPreferredSize()
  {
    ReportPane localReportPane = getReportPane();
    if ((!(localReportPane.isColumnHeaderVisible())) || (!(localReportPane.isRowHeaderVisible())))
      return new Dimension(0, 0);
    return new Dimension(localReportPane.getGridRow().getPreferredSize().width, localReportPane.getGridColumn().getPreferredSize().height);
  }

  public Color getBackground()
  {
    return super.getBackground();
  }

  public void setBackground(Color paramColor)
  {
    super.setBackground(paramColor);
  }
}